﻿(function () {
    CKEDITOR.plugins.add('workflow', {
        init: function (editor) {

            /*添加命令,工具栏，弹出框*/
            var addButtonCommand = function (buttonName, commandName, dialogFile) {
                editor.addCommand(commandName, new CKEDITOR.dialogCommand(commandName));

                editor.ui.addButton(buttonName,
				{
				    label: lang.common[buttonName.charAt(0).toLowerCase() + buttonName.slice(1)],
				    command: commandName
				});

                CKEDITOR.dialog.add(commandName, dialogFile);
            };

            var dialogPath = this.path + 'dialogs/';
            addButtonCommand('wftext', 'wftext', dialogPath + 'wftext.js');


            /*添加右键菜单*/
            if (editor.addMenuItems) {
                editor.addMenuItems(
				{
					editdiv:
					{
						label: lang.edit,
						command: 'editdiv',
						group: 'div'
					}
				});
            }
        }
    });
})();